package com.unieagle.exam.share;

import android.app.Activity;

import com.umeng.socialize.ShareAction;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.media.UMImage;
import com.umeng.socialize.media.UMWeb;
import com.unieagle.exam.R;
import com.unieagle.exam.utils.HttpUtils;

public class ShareHelper {
	
	private final static String TITLE = "安全培训专家，十五年行业经验，就是腾飞安培！";
	
	private final static String DESC = "始自2002，四川省安监局直属管理，值得信赖的正规培训机构。腾飞安培，以优质服务为企业成长、个人幸福保驾护航，期待您的接洽！";
	
	public static void doShare(Activity ac,int position) {
		switch(position) {
			case 0 :
				doShareToWx(ac);
				break;
			case 1 :
				doShareToWxPYQ(ac);
				break;
			case 2 :
				doShareToQQ(ac);
				break;
			case 3 :
				doShareToQzone(ac);
				break;
		}
	}

    private static void doShareToWx(Activity ac){
    	UMWeb web = new UMWeb(HttpUtils.getShareUrl());
        web.setTitle(TITLE);
        web.setThumb(new UMImage(ac, R.drawable.ic_launcher)); 
        web.setDescription(DESC);
    	new ShareAction(ac)
    	.setPlatform(SHARE_MEDIA.WEIXIN)
    	.withMedia(web)
    	.share();
    }
    
    private static void doShareToWxPYQ(Activity ac) {
    	UMWeb web = new UMWeb(HttpUtils.getShareUrl());
        web.setTitle(TITLE);
        web.setThumb(new UMImage(ac, R.drawable.ic_launcher)); 
        web.setDescription(DESC);
    	new ShareAction(ac)
    	.setPlatform(SHARE_MEDIA.WEIXIN_CIRCLE)
    	.withMedia(web)
    	.share();
    }
    
    private static void doShareToQzone(Activity ac) {
    	UMWeb web = new UMWeb(HttpUtils.getShareUrl());
        web.setTitle(TITLE);
        web.setThumb(new UMImage(ac, R.drawable.ic_launcher)); 
        web.setDescription(DESC);
    	new ShareAction(ac)
    	.setPlatform(SHARE_MEDIA.QZONE)
    	.withMedia(web)
    	.share();
    }
    
    private static void doShareToQQ(Activity ac) {
    	UMWeb web = new UMWeb(HttpUtils.getShareUrl());
        web.setTitle(TITLE);
        web.setThumb(new UMImage(ac, R.drawable.ic_launcher)); 
        web.setDescription(DESC);
    	new ShareAction(ac)
    	.setPlatform(SHARE_MEDIA.QQ)
    	.withMedia(web)
    	.share();
    }
    
}
